import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { PatientVO, PatientForm, PatientQuery } from '@/api/system/patient/types';

/**
 * 查询就诊卡列表
 * @param query
 * @returns {*}
 */

export const listPatient = (query?: PatientQuery): AxiosPromise<PatientVO[]> => {
  return request({
    url: '/system/patient/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询就诊卡详细
 * @param id
 */
export const getPatient = (id: string | number): AxiosPromise<PatientVO> => {
  return request({
    url: '/system/patient/' + id,
    method: 'get'
  });
};

/**
 * 新增就诊卡
 * @param data
 */
export const addPatient = (data: PatientForm) => {
  return request({
    url: '/system/patient',
    method: 'post',
    data: data
  });
};

/**
 * 修改就诊卡
 * @param data
 */
export const updatePatient = (data: PatientForm) => {
  return request({
    url: '/system/patient',
    method: 'put',
    data: data
  });
};

/**
 * 删除就诊卡
 * @param id
 */
export const delPatient = (id: string | number | Array<string | number>) => {
  return request({
    url: '/system/patient/' + id,
    method: 'delete'
  });
};
